home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
index.arc
/
AEBITNEX.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-01-21
|
1KB
|
75 lines
rem $linesize:132
rem $title:'Application Engineer Standard Routines'
rem $subtitle:'Find the NEXT key in lexical sequence.'
'
' this routine will return the next key in the index from the current
' one. if there are no current values for the key, then a negative
' value will be returned, else a positive value indicating the records -
' master and index - will be returned (or a zero if no next key).
'
'
' Have it do better on ends of chains.
'
' Include the COMMON values
'
rem $include:'AESHARED.BAS'
sub bit.next(fl%,ky$,mrec%,success%) static
pky$=ky$
pmrec%=mrec%
psuccess%=success%
tvalue%=success%
if success%=0 then
goto nonext
end if
get #fl%,success%
tkey$=xk$(fl%,1)
rght%=cvi(xk$(fl%,3))
if rght%=0 then
goto header
end if
success%=rght%
mleft:
get #fl%,success%
lft%=cvi(xk$(fl%,2))
if lft%=0 then
goto nhere
end if
success%=lft%
goto mleft
header:
parent%=cvi(xk$(fl%,4))
if parent%=0 then
goto nonext
end if
success%=parent%
get #fl%,success%
if xk$(fl%,1)>tkey$ then
goto nhere
end if
goto header
nhere:
mrec%=cvi(xk$(fl%,5))
ky$=xk$(fl%,1)
goto fnext
nonext:
ky$=""
mrec%=0
success%=0
fnext:
if success%=0% or mrec%=0% then
if pmrec%>0% and psuccess%>0% then
ky$=pky$
mrec%=pmrec%
success%=psuccess%
end if
end if
end sub